package org.spring.cloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
//import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;


@SpringBootApplication
//@EnableEurekaClient
//@EnableFeignClients
@EnableDiscoveryClient//开启eureka客户端发现
//允许断路器
@EnableCircuitBreaker
public class UserClientApplication {
	
	@Bean
	@LoadBalanced
	public RestTemplate restTemplate(){
		return new RestTemplate();
	}
	
	@Bean
    public IRule ribbonRule(){
        return new RandomRule();
    }
	
    public static void main( String[] args ){
        SpringApplication.run(UserClientApplication.class, args);
    }
}
